home *** CD-ROM | disk | FTP | other *** search
/ Click - International Series 1 / Click Jigsaw Puzzles: Ken Duncan.iso / mac / puzzles / FaceOfAges.dxr / 00222_streamStatus.ls < prev    next >
Encoding:
Text File  |  2002-11-11  |  2.9 KB  |  70 lines

  1. global statusChk, progressSprite, netID, progWide, badgeLine, gSM_StretchContent, puzzleDay, stageWide, stageTall, puzzlePicID, puzzleTxtID
  2.  
  3. on prepareMovie
  4.   clearGlobals()
  5.   put the movieAboutInfo & RETURN into field "version"
  6.   put the movieCopyrightInfo after field "version"
  7.   gSM_StretchContent = 0
  8.   resizeStage()
  9.   the idleHandlerPeriod = 0
  10.   set the exitLock to 1
  11.   set the rect of sprite 1 to rect(0, 21, stageWide, stageTall)
  12.   set the rect of sprite 40 to rect(0, 21, stageWide, stageTall)
  13.   netID = tellStreamStatus(1)
  14.   progWide = 259
  15.   progressSprite = 241
  16.   statusChk = 0
  17.   badgeLine = 0
  18.   set the stretch of sprite (progressSprite + 1) to 1
  19.   set the width of sprite (progressSprite + 1) to 1
  20.   member("puzzPicFile").editable = 0
  21.   put "Download progress" into member "puzzPicFile"
  22.   updateStage()
  23. end
  24.  
  25. on streamStatus url, state, bytesSoFar, bytesTotal, error
  26.   member("puzzPicFile").editable = 0
  27.   if netID > 0 then
  28.     set the height of sprite (progressSprite + 1) to 10
  29.     if statusChk = 0 then
  30.       startTimer()
  31.     end if
  32.     statusChk = statusChk + 1
  33.     case 1 of
  34.       (statusChk = 1):
  35.         currentPercent = bytesSoFar / float(bytesTotal)
  36.         put "Downloaded" && integer(currentPercent * 100) & "% -" && bytesSoFar / 1000 & "K of" && bytesTotal / 1000 & "K" into member "puzzPicFile"
  37.         if the width of sprite (progressSprite + 1) < (progWide * currentPercent) then
  38.           set the width of sprite (progressSprite + 1) to progWide * currentPercent
  39.           updateStage()
  40.         end if
  41.         startTimer()
  42.       ((statusChk < 5) and (statusChk > 1)):
  43.         currentPercent = bytesSoFar / float(bytesTotal)
  44.         put "Downloaded" && integer(currentPercent * 100) & "% -" && bytesSoFar / 1000 & "K of" && bytesTotal / 1000 & "K" into member "puzzPicFile"
  45.         if the width of sprite (progressSprite + 1) < (progWide * currentPercent) then
  46.           set the width of sprite (progressSprite + 1) to progWide * currentPercent
  47.           updateStage()
  48.         end if
  49.         updateStage()
  50.       (statusChk = 5):
  51.         currentPercent = bytesSoFar / float(bytesTotal)
  52.         put "Downloaded" && integer(currentPercent * 100) & "% -" && bytesSoFar / 1000 & "K of" && bytesTotal / 1000 & "K" into member "puzzPicFile"
  53.         if the width of sprite (progressSprite + 1) < (progWide * currentPercent) then
  54.           set the width of sprite (progressSprite + 1) to progWide * currentPercent
  55.           updateStage()
  56.         end if
  57.         updateStage()
  58.     end case
  59.     if statusChk >= 5 then
  60.       currentPercent = bytesSoFar / float(bytesTotal)
  61.       put "Downloaded" && integer(currentPercent * 100) & "% -" && bytesSoFar / 1000 & "K of" && bytesTotal / 1000 & "K" into member "puzzPicFile"
  62.       if the width of sprite (progressSprite + 1) < (progWide * currentPercent) then
  63.         set the width of sprite (progressSprite + 1) to progWide * currentPercent
  64.         updateStage()
  65.       end if
  66.       updateStage()
  67.     end if
  68.   end if
  69. end
  70.